home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
TURBOPASCAL WIN
/
DOCDEMOS.PAK
/
EWNDTEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-06-08
|
2KB
|
64 lines
{************************************************}
{ }
{ Turbo Pascal for Windows }
{ Demo program }
{ Copyright (c) 1991 by Borland International }
{ }
{************************************************}
program EWndTest;
{$R EWNDTEST.RES}
uses WObjects, WinTypes, WinProcs, Strings, StdWnds;
const
cm_SendText = 399;
type
TTestApplication = object(TApplication)
procedure InitMainWindow; virtual;
end;
PTestWindow = ^TTestWindow;
TTestWindow = object(TEditWindow)
constructor Init(AParent: PWindowsObject; ATitle: PChar);
procedure HandleSend(var Msg: TMessage);
virtual cm_First + cm_SendText;
end;
{ --------TTestWindow methods------------------ }
constructor TTestWindow.Init(AParent: PWindowsObject; ATitle: PChar);
begin
TEditWindow.Init(AParent, ATitle);
Attr.Menu := LoadMenu(HInstance, MakeIntResource(102));
end;
procedure TTestWindow.HandleSend(var Msg: TMessage);
var
Lines: Integer;
Text: array[0..20] of Char;
begin
Lines := Editor^.GetNumLines;
Str(Lines, Text);
StrCat(Text, ' lines sent');
MessageBox(HWindow, @Text, 'Message Sent', mb_Ok);
end;
{ -----------TTestApplication Methods------------ }
procedure TTestApplication.InitMainWindow;
begin
MainWindow := New(PTestWindow, Init(nil, 'Edit Window Tester'));
HAccTable := LoadAccelerators(HInstance, MakeIntResource(100));
end;
var
TestApp : TTestApplication;
begin
TestApp.Init('EWndTest');
TestApp.Run;
TestApp.Done;
end.